package com.lyl.exception.controller;

import com.lyl.exception.common.MyException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ExceptionController {

    @GetMapping("/test1")
    public String test1(){
        int i = 1/0;
        return "ok";
    }

    @GetMapping("/test2")
    public String test2(){
        String abc = null;
        boolean flag = abc.equals("abc");
        return "空指针异常";
    }

    @GetMapping("/test3")
    public String test3(Integer id){
        if(id > 0){
            throw new MyException("业务进行限制");
        }
        return "正常执行";
    }

}
